﻿Public Class TesterLogin

    Friend Property MainForm As PhDirForm.Form

    Private Sub ResetButton_Click(sender As System.Object, e As System.EventArgs) Handles ResetButton.Click
        Me.UsernameTextBox.Text = String.Empty
        Me.PasswordMaskedBox.Text = String.Empty
    End Sub

    Private Sub LoginButton_Click(sender As System.Object, e As System.EventArgs) Handles LoginButton.Click
        Dim isSuccess = Tester.Login(Me.UsernameTextBox.Text, Me.PasswordMaskedBox.Text)

        If isSuccess Then
            Me.MainForm.HideAllContentControls()
            Me.MainForm.TestingControl.Visible = True
            Me.MainForm.HeadingLabel.Text = "testing functionality"
        Else
            Me.FailLogin.Visible = True
        End If
    End Sub

    Private Sub TesterLogin_VisibleChanged(sender As System.Object, e As System.EventArgs) Handles MyBase.VisibleChanged
        Me.ResetButton_Click(Nothing, EventArgs.Empty)
        Me.FailLogin.Visible = False
    End Sub
End Class
